package com.hopu.emp_demo.controller;

import com.hopu.emp_demo.entity.Department;
import com.hopu.emp_demo.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DeptController {

    @Autowired
    private DepartmentService departmentService;

    @GetMapping("/departments")
    public ResponseEntity<List<Department>> findAll(){
        return ResponseEntity.ok(departmentService.findAll());
    }
}
